MKCONF_DIR = ../mkconfig
LIBC_DIR = ../libc
UTILS_DIR = ../utils


#CONF_FILES += $(TOPDIR)/../utility/configs/$(BOARD)/config.mk
CONF_FILES += $(TOPDIR)/../base/model/$(BOARD)/config/config.mk

Target = build/sys_$(BOARD)
Middle = $(obj)/sys_$(BOARD)

include $(MKCONF_DIR)/compile.mk
include $(MKCONF_DIR)/config.mk
sinclude build/$(BOARD)/autoconfig.mk

CPPFLAGS += -I../utility/include -I../base/model/$(BOARD)/config
export CPPFLAGS

-include ../mkconfig/sdk.mk

DIRS = ../base
ifeq ($(MKSDK), )
DIRS += ../base/fs
DIRS += ../base/common
DIRS += ../base/drivers/rfid
DIRS += ../base/drivers/icc_gpio
DIRS += ../libc
DIRS += ../utility/code
DIRS += ../utility/crypto
DIRS += ../utility/security/sec
endif
DIRS += ../utility
#DIRS += module


COBJS-y := main.o command.o shell.o cmd_date.o cmd_lcd.o 
COBJS-$(CONFIG_KBD) += cmd_kbd.o
COBJS-$(CONFIG_ICC_GPIO) += cmd_icc.o 
COBJS-$(CONFIG_ICC) += cmd_icc.o 

#COBJS-$(CONFIG_RFID_ISO14443) += cmd_picc.o
COBJS-$(CONFIG_MAGC) += cmd_magc.o
SOBJS-y :=
SRCS	:= $(COBJS-y:.o=.c) $(SOBJS-y:.o=.S)
OBJS	:= $(addprefix $(obj)/, $(COBJS-y) $(SOBJS-y))

NEED_BUILD_INFO := yes

LINKSCRIPT := ../sys/$(BOARD)/sh.ld


OBJS += ../base/build/$(BOARD)/libbase.o
OBJS += ../utility/build/$(BOARD)/libutility.o
LIBS :=	$(LIBC_DIR)/build/libc_$(ARCH).a


all: $(DIRS) $(Target).bin $(Target).hex


all: signature
signature: $(Target).bin
	@echo Signature the output binary to build/rxsys.bin ...
	@$(UTILS_DIR)/rxDnw --file_path=$< --file_type=0 --result_name=build/rxsys.bin


include $(MKCONF_DIR)/rules.mk
include $(MKCONF_DIR)/operation.mk
